<?php
include_once("function/config.php");
include('function/fnc.php');
$confirm_code=md5(uniqid(rand()));
$Confiremail = mysql_query("SELECT Confiremail FROM `admin`");
$get_user_data = mysql_fetch_array($Confiremail);


	// Check IP Quality Score 
	if(IPQC == "ON") {
	$key = IPQCKey; // Account API Key
	$ip = $_SERVER['REMOTE_ADDR']; // IP to Lookup
	$result = file_get_contents('http://www.ipqualityscore.com/api/ip_lookup.php?KEY='.$key.'&IP='.$ip);
		if($result == 1) {
			header("Location: oops.php");
		}
	}
	// Check ProxStop status
	if(ProxStop == "ON") {
		callProxstop();
	}
	
function check_email_address($email) {
    // First, we check that there's one @ symbol, and that the lengths are right
    if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
        // Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
        return false;
    }
    // Split it into sections to make life easier
    $email_array = explode("@", $email);
    $local_array = explode(".", $email_array[0]);
    for ($i = 0; $i < sizeof($local_array); $i++) {
         if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
            return false;
        }
    }    
    if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
        $domain_array = explode(".", $email_array[1]);
        if (sizeof($domain_array) < 2) {
                return false; // Not enough parts to domain
        }
        for ($i = 0; $i < sizeof($domain_array); $i++) {
            if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
                return false;
            }
        }
    }
    return true;
}

include("function/includes.php");

if(isset($_POST['register'])){
$oldusername = $_POST['username'];
$username = mysql_real_escape_string($oldusername);
$safeusername = addslashes($username);
$oldpassword = $_POST['password'];
$password = mysql_real_escape_string($oldpassword);
$email = $_POST['email'];
$points = $bonuspoints;

$memip = $_SERVER['REMOTE_ADDR'];
$memport = $_SERVER['REMOTE_PORT'];
$leadedOffers=0;
if(isset($_GET['join'])){
	$referral_ID = $_GET['join'];}
$date = date("Y-m-d H:i:s");
if($username == NULL OR $password == NULL OR $email == NULL){
$final_report2.= "Please complete all fields";
}else{
$check_ip = mysql_query("SELECT * FROM `members` WHERE `ip` = '$memip'");   
if(mysql_num_rows($check_ip) != 0){
$final_report2.="The Ip address is already in use!";  
}else{
$check_members = mysql_query("SELECT * FROM `members` WHERE `userName` = '$username'");   
if(mysql_num_rows($check_members) != 0){
$final_report2.="The username is already in use!";  
}else{ 
if(strlen($username) <= 5 || strlen($username) >= 33){
$final_report2.="Your username must be between 6 and 32 characters";
}else{ 
if(strlen($password) <= 5 || strlen($password) >= 33){
$final_report2.="Your password must be between 6 and 32 characters";
}else{
    if($get_user_data['Confiremail']==ON){ 
$create_member_temp = mysql_query("INSERT INTO `temp_members_db` (`confirm_code`,`userName`, `userPassword`, `email`, `points`,`leadedOffers`,`referralId`, `ip`,`port`, `date`,`requester`,`status`) 
VALUES('$confirm_code','$username','$password','$email','$points', '$leadedOffers','$referral_ID', '$memip','$memport','$date','','')"); 
$from="Admin";
$to=$_POST['email'];
$subject="Comfirmation from - F1scodes";
$message="Thank you,
To complete the registration please check email and click the confirmation link.
Confirmation Link: $yourdomain/confirmation.php?passkey=$confirm_code"; 
$options="Kind Regards,
Admin";
$sentmail = mail($to,$subject,$message,$options);
if($sentmail){
$final_report2.="To complete the registration please check email and click the confirmation link!";
$_SESSION['userName'] = $username;
$_SESSION['userPassword'] = $password;
$final_report2.="<meta http-equiv='Refresh' content='0; URL=wall.php?name=Sonicandroid'/>";
//$final_report2.="<meta http-equiv='Refresh' content='1; URL=login.php'/>";

}
}else {
       $create_member = mysql_query("INSERT INTO `members` (`id`,`userName`, `userPassword`, `email`, `points`,`leadedOffers`,`referralId`, `ip`,`port`, `date`,`requester`,`status`) 
VALUES('','$username','$password','$email','$points', '$leadedOffers','$referral_ID', '$memip','$memport','$date','','')"); 
$final_report2.="Thank you!";
$_SESSION['userName'] = $username;
$_SESSION['userPassword'] = $password;
$final_report2.="<meta http-equiv='Refresh' content='0; URL=wall.php?name=sonicandroid'/>";
//$final_report2.="<meta http-equiv='Refresh' content='1; URL=login.php'/>";
// if your email success 
}}}}}}}
?>

<?php if(isset($_SESSION['userName']) && isset($_SESSION['userPassword'])){
	header("Location: wall.php?name=sonicandroid");
	}
?>

<?php include("header.php");?>
	<link rel="stylesheet" href="offers.css" type="text/css" />
</head>

<body>
<!-- START CONTENT -->
<div id="wrapper">
	<!-- START HEADER -->
    <div id="header">
        <a class="logo" href="index.php<?php echo $referral_string?>"></a>
        <div class="login_box">

		</div>
	</div><!-- END HEADER -->
		
	<!-- START NAVIGATION -->
    <div id="nav">
	<ul id="navigation">
		<li><a href="index.php">Home</a></li>
		<li><a href="help.php">Help</a></li>
        <li><a href="contact.php">Contact</a></li>
        <?php if(!isset($_SESSION['userName']) || !isset($_SESSION['userPassword'])){  ?>
		<li class="on"><a href="register.php">SignUp</a></li>
		<?php } ?> 
		 <?php if(isset($_SESSION['userName']) && isset($_SESSION['userPassword'])){  ?>	
		<li><a href="logout.php">Logout</a></li>
		<?php } else { ?>
		<li><a href="login.php">Login</a></li>
        <?php } ?>
	</ul>	
    </div><!-- END NAVIGATION -->
    <div class="clear"></div>    

    <!-- START CONTENT -->
    <div id="content">
		<div class="register">	
			<h3>Register Form</h3>
			<form action="" method="post">
				<label for="username" class="label">Username</label> <input type="text" name="username" class="txt" value="
                <?php
srand((float) microtime() * 10000000);
$input = array(Neo,Morpheus, rinity, ypher, ank,Taighah,Tasha,Ryland, allen, age, Emma, dale, Diane, smith, Andrew, anderson, Doug, bell, Tiffany, williams, Arndt, zale, mark, cannon, ron, peters,SHAELYN, noland, Krbee, dallas,Nichol,thomas, vage, Lisa, thomas, James, thomasu, Dalesa, Peggy, walker, Caren, wilsom, Molly, bell, Mason, smithes, Jamie, mack, Beth, collins, Nicky, campbell,Jeff, Campbell, Keith, Barb, Wayne, craig,Amanda, Brendan, Sally, Daniel, Caitlin, DON, Bailey, Caitlin, Rebecca, Nolanre, Alexis, Katelyn, Paige, Daniel, Tallissa, stacee, Lane,Mariah, Teanna,  Lorne, Colleen, Jillian, Hayes, Mackenzie, Jonas, Piglet, guniea, Clucky, thehen, Jake, George, Mary, Kyle, Tim,Dawn, David, Ann, Joe, Teddy, Michaelw, Jenny, Sydney, Kylie, Patty, Kevin, Silversides, Kayden, Tianna, Keara, Austin, Taylor, Hannah, Rachael, April, Connor, Brett, Jenna, Blake,Dawn, Anakin, Courtney, Kayd, Victoria, Brandon, Dallin, Kennedi, Ian, Ryley, Ethan, Tara, turtle, Travis, Bob, Tony, Braydon, Trevor, Teanna, Carter, Cal, Gord, Tom, John, Dale,Jamey, Lou, Colin, Sunjay, Maneesha, Sangeeta, Sheri, Philip, Andrew, Ron, Ginger, Max, Rex, Marana, craig, Jason, Stephanie, Elizabeth, Robert, Brodie, Lynn, Margaret,Lee, Micheal, Paige, Debbie, Jack, Hazel, Ellen, Keith,Chelsay,Carolyn,Andreas,Hailey,Darlene,Courtney,Judy,Cheryl,Claudine,Farah,Scott,Tracy,Alexa,Alexis,David,Carl,Heather,Marlene,Jennifer,Rebecca,210,Ava,211,Hanah,212,Shauna,213,Natasya,214,Nikoulas,215,Abagail,216,Macala,217,Brandie,218,Mike,Donnar,Holly,Olive,Arter,Dwayne,Millie,Kyrin,Clayton,Beverly,Charlene,Kevino,Lisa,Marie,trym,Dawn,Graham,Stewart,Bruce,Francis,Reiner,Rae,Chis,Emily,Tim,Anne,Shelley,Ray,Mellisa,Bryan,Ian,Josh,Gary,Barry,
Jaime,Gail,Yvonne,Carla,Pat,Jeremie,Murray,Marty,
Richard, Tyra, Austin, Dyllan, Rayanna, Rae, lynn, Fiona, Ruby, Francine, Sabrina, Dalton, Dallin, dalma, Derrall, cyla, Donna ,Jana, Larry, Tyler, Cody, Evan,Doreen, Dell, Quinn, Gage, Michelle, Jeff, Irene,
);
$rand_keys = array_rand($input, 2);
echo $input[$rand_keys[0]] . $input[$rand_keys[1]] ;
?>
                " /><br>
				<label for="password" class="label">Password</label> <input type="password" name="password" class="txt" value="
               <?php echo $input[$rand_keys[0]] . $input[$rand_keys[1]] ; ?>
                " /><br>
				<label for="email" class="label">Email</label> <input type="text" name="email" class="txt" value="
                <?php echo $input[$rand_keys[0]].'@gmail.com'; ?>
                " /><br>
				<input type="submit" name="register" value="Register" class="btn"/>
			</form>
			<a href="login.php">Back to login page</a>
			<?php if($final_report2 !=""){?>
			<p class="error">
				<? echo $final_report2;?>
			</p>
			<?php } ?>
		</div>
	
    </div>
	<!-- END CONTENT -->
</div>
<?php include("footer.php");?>